package com.ocean.controller.user;

import com.ocean.entity.user.User;
import com.ocean.service.user.UserService;
import com.ocean.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xk
 * @version 1.0
 */
@RestController
@RequestMapping("/api/user/")
public class UserController {

    @Autowired
    private UserService service;

    @PostMapping("save.do")
    public R save(@RequestBody User user){
        return service.save(user);
    }
    @PostMapping("update.do")
    public R update(@RequestBody User user){
        return service.update(user);
    }
    @GetMapping("del.do")
    public R delete(int id){
        return service.delete(id);
    }
    @GetMapping("page.do")
    public R page(int page,int size){
        return service.queryPage(page, size);
    }
    @PostMapping("login.do")
    public R login(@RequestBody User user){
        return service.login(user);
    }
    @GetMapping("loginout.do")
    public R loginOut(String token){
        return R.ok();
    }

}
